package com.ruoyi.recyclecomprehensive.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.recyclecomprehensive.domain.Gift;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;

public interface GiftMapper extends BaseMapper<Gift> {
    @Select("select sum(sum) as sum from gift where merchant_id = ${merchantId}")
    BigDecimal sum(@Param("merchantId") Long merchantId);

    @Select("select sum(stock) as stock from gift where merchant_id = ${merchantId}")
    Integer countStock(@Param("merchantId") Long merchantId);
}
